package com.android.mvpdemo.model;

import com.android.mvpdemo.bean.User;

/**
 * Created by Lenovo on 2017/1/24.
 */
public class UserModel implements IUserModel {

    @Override
    public void login(final String username, final String password, final OnLoginListener loginListener) {
        new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                if (username.equals("lcx") && password.equals("123")) {
                    User user = new User();
                    user.setUsername(username);
                    user.setPassword(password);
                    loginListener.loginSuccess(user);
                } else {
                    loginListener.loginFailed("Login Failed 登录失败");
                }

            }
        }.start();
    }
}
